/** 病害相关的数据库初始化 */
import {
	TAB_DISEASEORDERLOG
} from "../config";

/** 初始化病害表 */
export const createDiseaseOrderLogTable = db => {
	const sql = `
		create table if not exists '${TAB_DISEASEORDERLOG}'(
			 _id  varchar(255),
			 id   int primary key,
			 pid  int, 
			 docId  int,
			 videoDocId int,
			 projectId int,
			 projectOrgId int,
			 startMileageFront  varchar(255),
			 endMileageFront  varchar(255),
			 startMileageAfter  varchar(255),
			 endMileageAfter  varchar(255),
			 startNumber  varchar(255),
			 endNumber  varchar(255),
			 others  varchar(255),
			 clockwisePosition  varchar(255),
			 diseaseStatus  varchar(255),
			 diseaseGrade  varchar(255),
			 diseaseGradeName  varchar(255),
			 diseaseGradeId  int,
			 diseaseGradeOld  varchar(255),
			 diseaseStandardLibraryId  int,
			 diseaseMaterialId  int,
			 diseaseNo  varchar(255),
			 diseaseNoOld  varchar(255),
			 isSandySoil  boolean,
			 isInfluenceEquipment  boolean,
			 isProtectionSection  boolean,
			 deviceLocation  varchar(255),
			 repairMethod  varchar(255),
			 orderType  varchar(255),
			 createDate  int,
			 firstInspectionDate  int,
			 lineId  varchar(255),
			 lineName  varchar(255),
			 lineSiteSectionId  varchar(255),
			 lineSiteSectionName  varchar(255),
			 mileage  varchar(255),
			 lineSiteSectionType  varchar(255),
			 createUserId  varchar(255),
			 createUserName  varchar(255),
			 followup  varchar(255),
			 inspectLogId  varchar(255),
			 inspectUser  varchar(255),
			 isDelete  boolean,
			 rankClass  varchar(255),
			 recordCreateDate  int,
			 recordUpdateDate  int,
			 inspectDate  int,
			 reviewUserId  varchar(255),
			 reviewUserName  varchar(255),
			 alterationUserId  varchar(255),
			 alterationUserName  varchar(255),
			 diseaseChange  varchar(255),
			 shiftOwnership  varchar(255),
			 stationLocation  varchar(255),
			 reviewDate  int,
			 inputValue  varchar(255),
			 type  varchar(255),
			 diseaseRemarks  varchar(255),
			 diseaseOrderId  int,
			 repairTeam varchar(255),
			 predictEndDate int,
			 predictOrderNo varchar(255),
			 examineExplain varchar(255),
			 examineName varchar(255),
			 examineResult varchar(255),
			 examineTime int,
			 checkName varchar(255),
			 checkResult varchar(255),
			 checkTime int,
			 checkDesc varchar(255),
			 pmId int,
			 pmName varchar(255),
			 projectName varchar(255),
			 branchLineName varchar(255)
		);
	`;
	return db.execute(sql);
}

export const fields = [
	'id',
	'docId',
	'videoDocId',
	'startMileageFront',
	'endMileageFront',
	'startMileageAfter',
	'endMileageAfter',
	'startNumber',
	'endNumber',
	'others',
	'clockwisePosition',
	'diseaseStatus',
	'diseaseGrade',
	'diseaseGradeName',
	'diseaseGradeId',
	'diseaseGradeOld',
	'diseaseStandardLibraryId',
	'diseaseMaterialId',
	'diseaseNo',
	'diseaseNoOld',
	'isSandySoil',
	'isInfluenceEquipment',
	'isProtectionSection',
	'deviceLocation',
	'repairMethod',
	'orderType',
	'createDate',
	'firstInspectionDate',
	'lineId',
	'lineName',
	'lineSiteSectionId',
	'lineSiteSectionName',
	'mileage',
	'lineSiteSectionType',
	'createUserId',
	'createUserName',
	'followup',
	'inspectLogId',
	'inspectUser',
	'isDelete',
	'rankClass',
	'recordCreateDate',
	'recordUpdateDate',
	'inspectDate',
	'reviewUserId',
	'reviewUserName',
	'alterationUserId',
	'alterationUserName',
	'diseaseChange',
	'shiftOwnership',
	'stationLocation',
	'reviewDate',
	'inputValue',
	'type',
	'diseaseRemarks',
	'diseaseOrderId',
	'pmId',
	'pmName',
	'projectName'
]
